package com.example.novelstory.controller.qjl;

import com.example.novelstory.entity.OrderInfo;
import com.example.novelstory.service.qjl.OrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "订单管理")
@CrossOrigin
@RestController
public class OrderController {
    @Resource
    OrderServiceImpl orderService;

    @PostMapping(value = "/findAll2")
    @ApiOperation(value = "订单查询")
    public List<OrderInfo> findAll(){
        List<OrderInfo> resultList = orderService.findAll2();
        return resultList;
    }

    @PostMapping(value = "/insert2")
    @ApiOperation(value = "订单添加")
    public boolean add(OrderInfo orderInfo){
        System.out.println(orderInfo);
        return orderService.save(orderInfo);
    }
    @PostMapping(value = "/delete2")
    @ApiOperation(value = "订单删除")
    public boolean delete(int orderInfoid){

        return orderService.daleteOrder(orderInfoid);
    }
    @PostMapping(value = "/update20")
    @ApiOperation(value = "修改")
    public boolean update(OrderInfo orderInfo){
        return orderService.updateOrder(orderInfo);
    }
}
